package com.zx.web.service.impl;

import com.zx.bean.User;
import com.zx.web.dao.UserDao;
import com.zx.web.dao.impl.UserDaoImpl;
import com.zx.web.service.UserService;

/**
 * @author 章鑫
 * @version V1.0
 * @Project 2022-09-05
 * @Package com.zx.web.service.impl
 * @Description:
 * @Date 2022/9/13 14:16
 */
public class UserServiceImpl implements UserService {
    UserDao dao = new UserDaoImpl();
    @Override
    public User findByUserName(String username) {
        User user = dao.findByUserName(username);
        return user;
    }

    @Override
    public boolean register(User user) {
        user.setFlag(1);
        user.setRole(0);
        return dao.register(user);
    }

    @Override
    public User login(String username, String password) {
        return dao.findByUserAndPwd(username,password);
    }
}
